package com.xujie.sportsmeeting.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.xujie.sportsmeeting.entity.CompetitionScore;

import java.util.List;

/**
 * 比赛成绩服务接口
 */
public interface CompetitionScoreService extends IService<CompetitionScore> {

    /**
     * 录入成绩
     */
    boolean recordScore(CompetitionScore score);

    /**
     * 批量录入成绩
     */
    boolean batchRecordScores(List<CompetitionScore> scores);

    /**
     * 更新成绩
     */
    boolean updateScore(CompetitionScore score);

    /**
     * 根据项目查询成绩列表
     */
    List<CompetitionScore> getEventScores(Long eventId, Integer isFinal);

    /**
     * 根据运动员查询成绩列表
     */
    List<CompetitionScore> getAthleteScores(Long athleteId);

    /**
     * 计算项目排名
     */
    boolean calculateRankings(Long eventId, Integer isFinal);

    /**
     * 检查成绩是否已存在
     */
    boolean scoreExists(Long eventId, Long athleteId, Integer isFinal);

    /**
     * 删除成绩
     */
    boolean deleteScore(Long scoreId);

    /**
     * 获取项目前N名成绩
     */
    List<CompetitionScore> getTopScores(Long eventId, Integer topN, Integer isFinal);

    /**
     * 根据成绩类型格式化成绩值
     */
    String formatScoreValue(String scoreValue, String scoreType);

    /**
     * 比较成绩大小 (用于排名)
     */
    int compareScores(String scoreValue1, String scoreValue2, String scoreType);
}
